import request from '@/utils/request'

/**
 * 获取组织架构信息
 * @returns {AxiosPromise}
 */
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

/**
 * 根据id删除指定部门
 * @param id
 * @returns {AxiosPromise}
 */
export function delDeptById(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 * 添加部门
 * @param {Object} data
 * @returns {AxiosPromise}
 */
export function addDept(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 根据id编辑部门
 * @param data
 * @returns {AxiosPromise}
 */
export function updateDept(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}

